{include_file name="Public/header" title="上传设置"}
		
		<!-- begin #content -->
		<div id="content" class="content">

			<!-- begin page-header -->
			<h1 class="page-header">上传设置</h1>
			<!-- end page-header -->


			<!-- begin row -->
			<div class="row">
                <!-- begin col-6 -->
				<div class="col-md-12 ">
					<!-- begin panel -->
					<div class="panel panel-inverse" data-sortable-id="form-stuff-2">
						<form action="{U('config/upload')}" method="POST" class="margin-bottom-0 js_uploadForm" enctype="multipart/form-data">
						<div class="panel-body">


							<fieldset>

								<div class="form-group">

									<label>允许上传图片格式：(<span class="label-tip">请用"|"分割格式，例如jpg|png|gif</span>)</label>

									<input type="text" name="upload[upload_pic_suffix]" value="{$upload_config.upload_pic_suffix}" class="form-control js_upload_pic_suffix" placeholder="jpg|png|gif" datatype="*2-50" nullmsg="请填写允许上传图片格式" errormsg="请填写允许上传图片格式" />

									<span class="Validform_checktip"></span>

								</div>





								<div class="form-group">

									<label>允许上传文件格式：(<span class="label-tip">请用"|"分割格式，例如zip|rar|doc|xls</span>)</label>

									<input type="text" name="upload[upload_file_suffix]" value="{$upload_config.upload_file_suffix}" class="form-control js_upload_file_suffix" placeholder="zip|rar|doc|xls" datatype="*2-50" nullmsg="请填写允许上传文件格式" errormsg="请填写允许上传文件格式" />

									<span class="Validform_checktip"></span>

								</div>

								<div class="form-group">

									<label>允许上传图片最大体积：(<span class="label-tip">单位:M，不能大于服务器限制上传最大体积{ini_get('upload_max_filesize')}</span>)</label>

									<input type="text" name="upload[upload_pic_size]" value="{$upload_config.upload_pic_size}" class="form-control js_upload_pic_size" placeholder="" datatype="n1-2" nullmsg="请填写允许上传文件体积" errormsg="允许上传文件最大不能超过99M" />

									<span class="Validform_checktip"></span>

								</div>

								<div class="form-group">

									<label>允许上传文件最大体积：(<span class="label-tip">单位:M，不能大于服务器限制上传最大体积{ini_get('upload_max_filesize')}</span>)</label>

									<input type="text" name="upload[upload_file_size]" class="form-control js_upload_file_size" value="{$upload_config.upload_file_size}" placeholder="" datatype="n1-2" nullmsg="请填写允许上传文件体积" errormsg="允许上传文件最大不能超过99M" />

									<span class="Validform_checktip"></span>

								</div>

								<div class="form-group">

									<label>水印类型：</label>

									<input type="radio" name="upload[upload_water_type]" class="js_waterType" value="1" {if $upload_config.upload_water_type == 1}checked{/if}> 文字

									<input type="radio" name="upload[upload_water_type]" class="js_waterType" value="2" {if $upload_config.upload_water_type == 2}checked{/if}> 图片

								</div>

								<div class="js_textBox {if $upload_config.upload_water_type != 1}hidden{/if}">

									<div class="form-group">

										<label>水印文字：</label>

										<input type="text" name="upload[upload_water_text]" value="{$upload_config.upload_water_text}" class="form-control js_upload_water_text"datatype="s1-20" nullmsg="请填写水印文字" errormsg="请输入1-20个字母或汉字" />

										<span class="Validform_checktip"></span>

									</div>

									<div class="form-group">

										<label>水印字体颜色：</label>

										<input type="text" name="upload[upload_water_color]" id="js_waterColor" class="form-control js_upload_water_color" value="{$upload_config.upload_water_color}" readonly datatype="*7-7" nullmsg="请选择水印字体颜色"  errormsg="颜色格式不正确" />

										<span class="Validform_checktip"></span>

									</div>

									<div class="form-group">

										<label>水印字体大小：(<span class="label-tip">单位:px</span>)</label>

										<input type="text" name="upload[upload_water_size]" value="{$upload_config.upload_water_size}" class="form-control js_upload_water_size" datatype="n1-2" nullmsg="请填写水印字体大小"  />

										<span class="Validform_checktip"></span>

									</div>

								</div>


								<div class="js_picBox {if $upload_config.upload_water_type != 2}hidden{/if}">

									<div class="form-group js_uploadBox">

										<label>上传水印图片：(<span class="label-tip">建议水印图片为png、gif等透明格式</span>)</label>

										<div class="btn-upload">

											{$water_src = $upload_config.upload_water_src}
											<a href="javascript:void(0);"><i class="fa fa-download"></i><span class="js_uploadText">上传</span>水印图片</a>

											<input class="js_cover js_upFile" type="file" name="upload_water_src">

										</div>


										<div class="js_showBox {if !$water_src}hidden{/if}"><img class="js_logoBox" src="{_image($water_src)}" width="300px" ></div>

									</div>



									<div class="form-group">

										<label>水印透明度：(<span class="label-tip">单位:%,数值越小越透明</span>)</label>

										<input type="text" name="upload[upload_water_opacity]" value="{$upload_config.upload_water_opacity}" class="form-control js_upload_water_opacity" datatype="n1-2" nullmsg="请填写水印透明度" errormsg="水印透明度只能在0-100之间" />

										<span class="Validform_checktip"></span>

									</div>

								</div>


								<div class="form-group">

									<label>水印位置：</label>

									<select class="form-control width-middle js_upload_water_position" name="upload[upload_water_position]">

										<option value="1" {if $upload_config.upload_water_position == 1 }selected{/if}>顶部居左</option>

										<option value="2" {if $upload_config.upload_water_position == 2 }selected{/if}>顶部居中</option>

										<option value="3" {if $upload_config.upload_water_position == 3 }selected{/if}>顶部居右</option>

										<option value="4" {if $upload_config.upload_water_position == 4 }selected{/if}>中间居左</option>

										<option value="5" {if $upload_config.upload_water_position == 5 }selected{/if}>居中</option>

										<option value="6" {if $upload_config.upload_water_position == 6 }selected{/if}>中间居右</option>

										<option value="7" {if $upload_config.upload_water_position == 7 }selected{/if}>底部居左</option>

										<option value="8" {if $upload_config.upload_water_position == 8 }selected{/if}>底部居中</option>

										<option value="9" {if $upload_config.upload_water_position == 9 }selected{/if}>底部居右</option>

									</select>

								</div>

								<button type="submit" class="btn btn-sm btn-primary m-r-5 js_submit">保存设置</button>
							</fieldset>

						</div>
						</form>

						</div>
				</div>
					<!-- end panel -->
			</div>
                <!-- end col-6 -->
            <!-- end row -->
		</div>
		<!-- end #content -->

<!--上传前预览插件，更多用法请访问http://www.gouguoyin.cn/js/81.html-->
<link href="{STATIC_PLUG}/jquery-uploadview/jquery.uploadview.css?v={VERSION}" rel="stylesheet" />
<script src="{STATIC_PLUG}/jquery-uploadview/jquery.uploadview.js?v={VERSION}" type="text/javascript"></script>
<!--时间选择器-->
<link href="{STATIC_PLUG}/jquery-colorpicker/jquery.bigcolorpicker.css?v={VERSION}" rel="stylesheet" />
<script src="{STATIC_PLUG}/jquery-colorpicker/jquery.bigcolorpicker.min.js?v={VERSION}" type="text/javascript"></script>

<script>
	$(function(){
		//提交表单合法性验证
		$("form").Validform({

			tiptype:function(msg,o,cssctl){

				if(!o.obj.is("form")){

					var objtip=o.obj.siblings(".Validform_checktip");

					cssctl(objtip,o.type);

					objtip.text(msg);

				}

			},

			label:"label",
			btnSubmit:".js_submit",
			beforeSubmit:function(){
				var phpMaxSize = "{ini_get('upload_max_filesize')}";

				var picMaxSize = $(".js_upload_pic_size").val();

				var fileMaxSize = $(".js_upload_file_size").val();

                if(0 >= picMaxSize){

                    alert('允许上传图片最大体积不能小于0');

                    $(".js_upload_pic_size").focus();

                    return false;

                }

                if(0 >=  fileMaxSize){

                    alert('允许上传文件最大体积不能小于0');

                    $(".js_upload_file_size").focus();

                    return false;

                }

				if(parseInt(phpMaxSize) < picMaxSize){

					alert('服务器限制最大上传大小不能超过'+phpMaxSize);

					$(".js_upload_pic_size").focus();

					return false;

				}

				if(parseInt(phpMaxSize) < fileMaxSize){

					alert('服务器限制最大上传大小不能超过'+phpMaxSize);

					$(".js_upload_file_size").focus();

					return false;

				}


				$(".js_submit").attr("disabled", "disabled").text('提交中..');

			},

		});

		//配置上传预览插件
		$(".js_upFile").uploadView({

			uploadBox: '.js_uploadBox',//设置上传框容器

			showBox : '.js_showBox',//设置显示预览图片的容器

			width : 300, //预览图片的宽度，单位px

			allowType: ["gif", "jpeg", "jpg", "bmp", "png"], //允许上传图片的类型

			maxSize :1, //允许上传图片的最大尺寸，单位M

			success:function(e){

				$(".js_uploadText").text('更改');
				$(".js_showBox").removeClass("hidden");

				//alert('图片上传成功');

			}

		});

		//颜色选择器
		$("#js_waterColor").bigColorpicker("js_waterColor");

		//水印类型切换
		$(".js_waterType").change(function(){

			var watermarkType = $(".js_waterType:checked").val();

			if(watermarkType == 1){

				$(".js_textBox").removeClass('hidden');

				$(".js_picBox").addClass('hidden');

			}else{

				$(".js_textBox").addClass('hidden');

				$(".js_picBox").removeClass('hidden');

			}

		});


	})

</script>
{include_file name="Public/footer"}